import {api} from './libs/api.js';
let _self;
export const index =  {
	data() {
		return {
			optLock:false,
			icons:{"50":uni.upx2px(50),"60":uni.upx2px(60),"40":uni.upx2px(40)},
			dataList:[],
			searchShow:false,
			params:{
				page: 1,
				pageSize: 20,
			},
			searchData:{}
		}
	},
	
	
	
	watch:{
		searchData(val){
			//this.dataList=[];
			this.initData();
		},
	},
	
	mounted() {
		_self = this;
	},
	onReachBottom:function(e){
		this.params.page+=1;
		this.initData();
	},
	onLoad:function(option) {
		//this.tabSubItem=option.status;
	},
	
	methods: {
		async initData(){
			uni.showLoading({title: '加载中'});
			let postData = Object.assign(this.params,this.searchData);	//合并对象		
			
			let dataInfo=await api.quantityList(postData);
			if(this.params.page==1){
				this.dataList=dataInfo;
			}else{
				if(dataInfo.length==0) this.params.page-=1;
				this.dataList.push.apply(this.dataList,dataInfo);
			}
		
			uni.hideLoading();
		},
		
		popupShow(){
			this.searchShow = true;
		}	
		
	},
}